package com.fa4j.third.base.config;

import com.fa4j.third.base.adapter.AbstractThirdServiceAdapter;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * 三方适配器配置
 */
@Data
public class ThirdAdapterConfigurer {

    /**
     * 适配器类别
     */
    private final List<Class<? extends AbstractThirdServiceAdapter>> adapterClassList = new ArrayList<>();

    @SafeVarargs
    public ThirdAdapterConfigurer(Class<? extends AbstractThirdServiceAdapter>... adapterClasses) {
        addAdapter(adapterClasses);
    }

    @SafeVarargs
    public final void addAdapter(Class<? extends AbstractThirdServiceAdapter>... adapterClasses) {
        if (adapterClasses != null && adapterClasses.length > 0) {
            adapterClassList.addAll(Stream.of(adapterClasses).toList());
        }
    }


}
